
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" >
<head>
	<title>PlotKit.Base | liquidx</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<link href="http://media.liquidx.net/css/x_general.css" media="screen" rel="Stylesheet" type="text/css" />
	<link href="http://media.liquidx.net/css/x_header.css" media="screen" rel="Stylesheet" type="text/css" />
	<link href="http://media.liquidx.net/css/x_layout.css" media="screen" rel="Stylesheet" type="text/css" />	
	<link href="http://media.liquidx.net/css/x_blocks.css" media="screen" rel="Stylesheet" type="text/css" />
	<link rel="icon" href="/favicon.png" type="image/x-png">
	<link rel="shortcut icon" href="/favicon.png" type="image/x-png">
	<!--[if lt IE 7.]>	
	<script defer type="text/javascript" src="http://media.liquidx.net/js/pngfix.js"></script>
	<![endif]-->
	
<link href="doc.css" media="screen" rel="stylesheet" type="text/css" />

</head>

<body>
    <div id="header">
        <div id="logo"><a href="http://www.liquidx.net/"><img src="http://media.liquidx.net/imgx/logo.png" width="256" height="128" alt="liquidx.net" /></a></div>
		<div id="menu-hack">
			<div id="menu-l"><img src="http://media.liquidx.net/imgx/menu_l.png" width="17" height="28" alt="menu cap" /></div><div id="menu-r"><img src="http://media.liquidx.net/imgx/menu_r.png" width="17" height="28" alt="menu cap" /></div>			
            <div id="menu-main">
        		<ul id="menu" class="code">
            		<li class="tab" id="blog"><a href="http://www.liquidx.net/" title="blog/home">blog</a></li>
            		<li class="tab" id="code"><a href="http://www.liquidx.net/code/" title="software i have written">software</a></li>
            		<li class="tab" id="dev"><a href="http://projects.liquidx.net/" title="source code for my open source projects">dev</a></li>
            		<li class="tab" id="photos"><a href="http://al.tse.id.au/gallery/" title="photos and videos">photos</a></li>
             		<li class="tab" id="research"><a href="http://al.tse.id.au/research/" title="research profile">research</a></li>
             		<li class="tab" id="links"><a href="http://www.liquidx.net/links/" title="my bookmarks">linkblog</a></li>
             		<li class="tab" id="stats"><a href="http://stats.liquidx.net/" title="stats for various parts of my website">stats</a></li>
             		<li class="tab" id="status"><a href="http://www.liquidx.net/status/" title="weather report for alastair">status</a></li>
             		<li class="tab" id="about"><a href="http://al.tse.id.au/" title="about alastair tse">aboutme</a></li>
        		</ul>
        	</div>
    	</div>
		<div id="quickbuttons">
			<span class="quickbutton"><a href="http://www.liquidx.net/albumartwidget/"><img src="http://media.liquidx.net/imgx/quick_widget.png" alt="album art widget" /></a></span>
			<span class="quickbutton"><a href="http://www.liquidx.net/plotkit/"><img src="http://media.liquidx.net/imgx/quick_plotkit.png" alt="plotkit" /></a></span>
			<span class="quickbutton"><a href="http://www.liquidx.net/fruity/"><img src="http://media.liquidx.net/imgx/quick_fruity.png" alt="fruity" /></a></span>
		</div>
		
	</div>
    
    <div id="body">
<div class="page doc api">

<p> <a href="PlotKit.html">PlotKit Home</a> | <a href="PlotKit.Layout.html">&gt;&gt;</a> 
</p>

<h1> PlotKit Base</h1>
<p>PlotKit Base contains a number of simple functions that are needed for the rest of the PlotKit libraries.
</p>

<h2> PlotKit.Base Functions</h2>
<ul>
 <li>
      <code>collapse()</code> 
 </li>
</ul>
<p>   Given an array, it will collapse all the values from the passed array into one big array.
</p>
<p> <code>[[1,2], [3,4], [5,6]] --&gt; [1, 2, 3, 4, 5, 6]</code> 
</p>
<ul>
 <li>
      <code>findPosX(element)</code> 
 </li>
</ul>
<p>  Returns the X value of the element relative to the document in a browser independent way.
</p>
<ul>
 <li>
      <code>findPosY(element)</code> 
 </li>
</ul>
<p>  Returns the Y value of the element relative to the document in a browser independent way.
</p>
<ul>
 <li>
      <code>palette(baseColor, fromLevel = -0.2, toLevel = 0.2, increment = 0.1)</code> 
 </li>
</ul>
<p>  Takes in a base colour and generates a palette of colours based on the intensive levels.
</p>
<ul>
 <li>
      <code>roundInterval(value, precision)</code> 
 </li>
</ul>
<p>  Rounds a number to a specified precision. <strong>TODO: make more robust</strong> 
</p>
<ul>
 <li>
      <code>uniq(array)</code> 
 </li>
</ul>
<p>  Acts like the UNIX uniq, takes a sorted array and returns a new array that only contains uniq elements.
</p>
<ul>
 <li>
      <code>isFuncLike(obj)</code> (PlotKit 0.9+)
 </li>
</ul>
<p>  Returns true if it is of type <code>function</code>.
</p>
<ul>
 <li>
      <code>usingPrototype()</code>  (PlotKit 0.9+)
 </li>
</ul>
<p>  Checks whether the javascript runtime is polluted by prototype.js
</p>
<ul>
 <li>
      <code>items(lst)</code>  (PlotKit 0.9+)
 </li>
</ul>
<p>  A version of <code>MochiKit.Base.items()</code> that is aware of prototype.js
</p>
<ul>
 <li>
      <code>keys(lst)</code>  (PlotKit 0.9+)
 </li>
</ul>
<p>  A version of <code>MochiKit.Base.keys()</code> that is aware of prototype.js
</p>
<ul>
 <li>
      <code>map(fn, lst)</code>  (PlotKit 0.9+)
 </li>
</ul>
<p>  A version of <code>MochiKit.Base.map()</code> that is aware of prototype.js
</p>

<h1> Preset Styles</h1>

<h2> Color Schemes</h2>
<p>There are some colour schemes, which are an array of
   MochiKit.Color.Colors.
</p>
<ul>
 <li>
      <code>colorScheme()</code> 
 </li>
</ul>
<p>A default colour scheme that consists of red, orange, yellow, green, cyan, blue, purple and magenta.
</p>
<ul>
 <li>
      <code>baseDarkPrimaryColors()</code> 
 </li>
</ul>
<p>A set of five dark colours.
</p>
<ul>
 <li>
      <code>basePrimaryColors()</code> 
 </li>
</ul>
<p>A set of five bright primary colours.
</p>
<ul>
 <li>
      <code>baseBlueColors()</code> 
 </li>
</ul>
<p>Three colour set that have a nice professional blue hue.
</p>

<h2> Office Style</h2>
<p>These are base styles that were inspired by charts in Office 12. The
   color schemes are fairly similar to those found in screenshots of
   charts available online.
</p>
<ul>
 <li>
      <code>officeBaseStyle</code> 
 </li>
</ul>
<p>  Contains the basic style independent of colours.
</p>
<ul>
 <li>
      <code>officeBlue()</code> 
 </li>
</ul>
<p>  Blue colors: <img src="blue.png" alt="bluecolors"/> 
</p>
<ul>
 <li>
      <code>officeRed()</code> 
 </li>
</ul>
<p>  Red colors: <img src="red.png" alt="redcolors"/> 
</p>
<ul>
 <li>
      <code>officeGreen()</code> 
 </li>
</ul>
<p>  Green colors: <img src="green.png" alt="greencolors"/> 
</p>
<ul>
 <li>
      <code>officePurple()</code> 
 </li>
</ul>
<p>  Purple colors: <img src="purple.png" alt="purplecolors"/> 
</p>
<ul>
 <li>
      <code>officeCyan()</code> 
 </li>
</ul>
<p>  Cyan colors: <img src="cyan.png" alt="cyancolors"/> 
</p>
<ul>
 <li>
      <code>officeOrange()</code> 
 </li>
</ul>
<p>  Orange colors: <img src="orange.png" alt="orangecolors"/> 
</p>
<ul>
 <li>
      <code>officeBlack()</code> 
 </li>
</ul>
<p>  Black colors: <img src="black.png" alt="blackcolors"/> 
</p>

<h2> Usage</h2>
<p>  <code>var layout = PlotKit.Layout(&quot;bar&quot;, officeOrange());</code> 
</p>


</div>
</div>

    
	
    
    <div id="footer">
		<div class="block">
			<h3>Syndication Feeds:</h3>
			<p>
				<ul class="tiny">
					<li><a href="http://www.liquidx.net/blog/feed/atom/" class="feed" title="feed for all posts on liquidx.net"><img src="http://media.liquidx.net/imgx/feed.gif" class="feed" alt="feed" />Atom Feed for the Blog Entries</a></li>
					<li><a href="http://www.liquidx.net/blog/feed/rss/" class="feed" title="feed for all posts on liquidx.net"><img src="http://media.liquidx.net/imgx/feed.gif" class="feed" alt="feed" />RSS Feed for the Blog Entries</a></li>
					<li><a href="http://www.liquidx.net/comments/feed/atom/" class="feed" title="feed for all posts on liquidx.net"><img src="http://media.liquidx.net/imgx/feed.gif" class="feed" alt="feed" />Feed for All Comments</a></li>
					<li><a href="http://www.liquidx.net/links/feed/atom/" class="feed" title="feed for all bookmarked links"><img src="http://media.liquidx.net/imgx/feed.gif" class="feed" alt="feed" />Feed for Links</a></li>
				</ul>
			</p>
		</div>
		<div class="block">
			<h3>About this site:</h3>
			<p>Content on this site is licensed under <a href="http://creativecommons.org/licenses/by/2.5/">CC By Attribution</a> unless otherwise specified. 
			Copyright (c) 2002-2006, <a href="http://al.tse.id.au/">Alastair Tse</a>.</p>
			<p>For more information, see <a href="http://al.tse.id.au/">al.tse.id.au</a>.</p>
			<p><script type="text/javascript" src="http://technorati.com/embed/itwctkzez.js"></script></p>
		</div>
		<div class="block">
			<h3>Is Made Possible By:</h3>
			<p>
			<dl>
				<dt><a href="http://ecto.kung-foo.tv/" class="clean">ecto</a>. </dt>
				<dd>Blogging client for Mac</dd>
				<dt><a href="http://djangoproject.com/" class="clean">Django</a>. </dt>
				<dd>Python Web Framework</dd>
				<dt><a href="http://www.lighttpd.net/" class="clean">lighttpd</a>. </dt> 
				<dd>Really Fast Web Server</dd>
				<dt><a href="http://www.saddi.com/software/flup/" class="clean">flup</a>. </dt>
				<dd>FastCGI for Python</dd>
			</dl>
			</p>
		</div>
        <div class="block">
            <h3>Search My Sites:</h3>
            <p>
           <div style='margin: 10px; text-align: center; width: 160px;'><form action='http://www.rollyo.com/search.html' ><fieldset style='margin: 0; padding: 4px 0 0 0; height: 60px; border: none; background: url(http://rollyo.com/remote/togo-bg4.png) no-repeat top left;'><div style="position: absolute; float:left; z-index:99; width: 46px; height: 50px;"><a href="http://rollyo.com"><img style="border: none;" height="50" width="46" src="http://rollyo.com/remote/x.gif"></a></div> <input type='text' size='30' style='float: left; width: 90px; margin: 2px 0 0 48px; padding: 0; font-size: 12px;' name='q' value='Search...' onclick='this.value="";' /><br /> <select name='sid' style='float: left; width: 78px; height: 15px; margin: 12px 0 0 46px; font-size: 7pt; padding: 0;'><option value='106081' selected='selected'>liquidx</option><option value='web'>Search The Web</option></select><input type='image' src='http://rollyo.com/remote/btn-togo.png' alt='Go' style='margin: 12px 0 0 3px; float: left;' /><input type='hidden' name='togo-v' value='1' /></fieldset></form></div>
               </p>
          </div>
         
    
		<div class="clear">&nbsp;</div>
        
    </div>



   <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
   <script type="text/javascript">
   _uacct = "UA-58117-1";
   urchinTracker();
   </script>

</body>
</html>
